Component({
  data: {
    selected: 0
  },
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset;
      const url = data.path;
      // 已在该标签栏下,无需跳转
      if (this.data.selected == data.index) return;
      wx.switchTab({
        url
      })
      this.setData({
        selected: data.index
      })
    }
  }
})